﻿@{
    ViewBag.Title = Local("CategoryView.PageTile");
    Layout = GetPath(SystemDirectory.Shared, "_Dialog.cshtml");
}

@model Category

@if (IsValided)
{
    using (Html.BeginForm())
    { 
        <div class="box">
            <label>@GLocal("Category.CategoryName")</label>
            <div class="right">
                @Html.TextBoxFor(model=>model.CategoryName)
            </div>
        </div> 
    
        <div class="box">
            <label>@GLocal("Category.IsVisiable")</label>
            <div class="right">
                @Html.CheckBoxFor(model => model.IsVisiable)
            </div>
        </div>
    
        <div class="box">
            <label>@GLocal("Category.Key")</label>
            <div class="right">
                @Html.TextBoxFor(model => model.Key)
                <div class="summary">@GLocal("Category.Key.Summary")</div>
            </div>
        </div>
    
        <div class="box">
            <label>@GLocal("Category.ApplicationType")</label>
            <div class="right">
                @Html.DropDownListApplicationTypeFor(model => model.ApplicationType)
            </div>
        </div>
    
        <div class="box">
            <label>@GLocal("Category.ParentID")</label>
            <div class="right">
                @Html.DropdownListCategoryFor(model => model.ParentID, Model.ApplicationType, Model.CategoryID)
            </div>
        </div>
    
        <div class="box">
            <label>@GLocal("Category.LogoUrl")</label>
            <div class="right">
                @Html.TextBoxFor(model => model.LogoUrl, new { @class = "hide" })
                <div style="margin-top:10px;">
                    <img src="@Model.LogoUrl" alt="@GLocal("Category.SelectedIcon")" title="@GLocal("Category.SelectedIcon")" id="logo" onclick="return openModal('@Mozlite.Web.UI.Areas.UCenter.UCenterUrls.DialogDiskView?type=@FileType.Image', 500);" style="width:@(Application.Current.Configuration.CategoryWidth)px; height:@(Application.Current.Configuration.CategoryHeight)px;" />
                </div>
            </div>
        </div>
    
        <div class="box">
            <label>@GLocal("Category.Description")</label>
            <div class="right">
                @Html.TextAreaFor(model => model.Description)
            </div>
        </div>
    
        <div class="box">
            <button class="submit">@GLocal("Category.Save")</button>
        </div>
    }
    <script type="text/javascript">
        function callback(id) {
            var url = '@GetFileBrowserUrl()'+id;
            $('#logo').attr('src', url);
            $('#LogoUrl').val(url);
        }
    </script>
}
